import java.util.List;
import java.util.Stack;

public class project {
    public int equalSubstring(String s, String t, int maxCost) {
        int len=s.length();
        int[] arr=new int[len];
        for(int i=0;i<len;i++){
            arr[i]=Math.abs(s.charAt(i)- t.charAt(i));
        }
        int left=0;
        int right=0;
        int sum=0;
        int max=0;
        while (right<len){
            sum+=arr[right];
            while (sum>maxCost){
                sum-=arr[left];
                left++;
            }
            max=Math.max(max,right-left+1);
            right++;
        }
        return max;
    }

















    public String removeDuplicates(String s, int k) {
        StringBuilder sb=new StringBuilder(s);
        Stack<Integer> stack=new Stack<>();
        for(int i=0;i<sb.length();i++){
            if(i==0||sb.charAt(i)!=sb.charAt(i-1)){
                stack.push(1);
            }else{
                int value=stack.pop()+1;
                if(value==k){
                    sb.delete(i-k+1,i+1);
                    i=i-k;
                }else{
                    stack.push(value);
                }
            }
        }
        return sb.toString();
    }















    public int minMoves(int target, int maxDoubles) {
        if(target==1||maxDoubles==0){
            return target-1;
        }else if(target%2==0){
            return minMoves(target/2,maxDoubles-1)+1;
        }else{
            return minMoves((target-1)/2,maxDoubles-1)+2;
        }
    }


















    public int[] closestDivisors(int num) {
        int tmp=num==1?num+1:num+2;
        int i=(int) Math.sqrt(tmp);
        while (tmp%i>1){
            i++;
        }
        return new int[]{i,tmp/i};
    }
















    public static void main(String[] args) {
        int ret=trailingZeroes(30);
        System.out.println(ret);
    }







    public static int trailingZeroes(int n) {
        int count=0;
        do{
            count+=n/5;
            n/=5;
        }while (n>0);
        return count;
    }
}
